<%@page import="com.entity.Comment"%>
<%@page import="com.service.impl.CommentServiceImpl"%>
<%@page import="com.service.CommentService"%>
<%@page import="com.service.impl.NewServiceImpl"%>
<%@page import="com.entity.New"%>
<%@page import="java.util.List"%>
<%@page import="com.service.NewService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<jsp:include page="common/header.jsp"></jsp:include>
	<h2>新闻详情</h2>
	<%
		String id = request.getParameter("nid");
		NewService newService = new NewServiceImpl();
		New news = newService.selectNewById(Integer.parseInt(id));
	%>
	<h4><%=news.getNtitle()%></h4>
	<p><%=news.getNauthor()%></p>
	<p><%=news.getNcreateDate()%></p>
	<p><%=news.getNcontent()%></p>
	<p><img src="${imgPath}<%=news.getNpicPath()%>"></p>
	<h4>新闻评论</h4>

	<%
		CommentService commentService = new CommentServiceImpl();
		List<Comment> comments = commentService.selectCommentByNid(news.getNid());
		for(Comment comment : comments){
			%>
			<p><u><%=comment.getCauthor() %></u><br><%=comment.getCcontent() %> ——  <%=comment.getCdate()  %> </p>
			<%
		}
	%>

</body>
</html>